package pbbltobpel.parser;

import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class Fact implements IXmlReader{
	private List<String> params;
	private int id;
	private String name;
	
	public Fact() {
		params = new ArrayList<String>();
	}
	
	public List<String> getParams() {
		return params;
	}
	public void setParams(List<String> params) {
		this.params = params;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public void getFromXmlElement(Element el) {
		id = Integer.parseInt(el.getAttribute("id"));
		name = el.getAttribute("name");
		NodeList p = el.getElementsByTagName("param");
		for(int i = 0; i < p.getLength(); i++){
			Element node = (Element)p.item(i);  
			String text = node.getTextContent();
			params.add(text);
		}
	}
}
